-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reveal trait and its implementations for ProtocolContext
#223
Reveal trait and its implementations for ProtocolContext
#223
Conversation
Another step to make sort protocol support both semi-honest and malicious security. In semi-honest setting, `CheckZero` and `ConvertShares` will use semi-honest reveal with a cost of 1 multiplication. Malicious reveal currently has a cost of 2 multiplications and will be used only for malicious setting. This change leverages recently stabilized GAT (https://blog.rust-lang.org/2022/10/28/gats-stabilization.html). If we like this implementation, `SecureMul` will be changed accordingly.abilized GAT (https://blog.rust-lang.org/2022/10/28/gats-stabilization.html). If we like this implementation, `SecureMul` will be changed accordingly.
It drops `SecurityValidator` so it is not really that useful. Reveal does not care, so it can use it
src/test_fixture/sharing.rs
Outdated
share(input, rng) | ||
.iter() | ||
.enumerate() | ||
.map(|(i, share)| MaliciousReplicated::new(*share, r[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this is right. The second argument should be a sharing of input times r. This appears be be just r.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you want:
let r = validate_and_reconstruct((r[0], r[1], r[2]));
let rx = r * input;
zip(share(input, rng), share(rx, rng))
.map(|(x, rx)| MaliciousReplicated::new(*x, *rx))
.collect::<Vec<_>>()
.try_into()
.unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep that was a bug. I decided to generate r
inside share_malicious
given that I have access to PRNG there. Lmk if that is not ergonomic (we could always reconstruct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Just one conflict and the issue with the test fixture (which works ATM because you’re not really using any properties of the malicious replicated secret sharing in these particular tests, but which should still be resolved)
src/test_fixture/sharing.rs
Outdated
.iter() | ||
.zip(share(rx, rng)) | ||
.map(|(x, rx)| MaliciousReplicated::new(*x, rx)) | ||
// TODO: each_ref when stable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does each_ref() work with zip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should work if array::zip
is stable rust-lang/rust#80094. I'll mention both in the todo
3384425
to
6dd9b4b
Compare
sorry had to force push as I screwed up during merge and it is quite painful to do it again :( |
Another step to make sort protocol support both semi-honest and malicious security.
In semi-honest setting,
CheckZero
andConvertShares
will use semi-honest reveal with a cost of 1 multiplication. Malicious reveal currently has a cost of 2 multiplications and will be used only for malicious setting.This change leverages recently stabilized GAT.
If we like this implementation,I tried it and I don't think it works for multiplicationSecureMul
will be changed accordingly.